import React from "react";
import { Form, Button, Input, message } from "antd";
import { useNavigate } from "react-router-dom";
import { add_list } from "../../../utils/api/index";
import "../../../styles/Createdeposit.scss";
interface Props { }
function Createdeposit(props: Props) {
  var navigate = useNavigate();
  const onFinish = (values: any) => {
    //新建出库
    add_list(values).then((res) => {
      // console.log(res.data);
      if (res.request.status == 201) {
        message.open({ type: "success", content: "添加成功!" });
        navigate("/index/home/deposit/depositList");
      } else {
        message.open({ type: "error", content: "添加失败!" });
      }
    });
  };
  const onFinishFailed = (errorInfo: any) => {
    console.log("Failed:", errorInfo);
  };
  let cancel = function () {
    navigate("/index/home/deposit/depositList");
  };
  return (
    <div className="createdeposit">
      <div className="head">仓储管理 / 出库管理 / 新建出库</div>
      <div className="main">
        <div className="box">
          <Form
            name="basic"
            labelCol={{ span: 6 }}
            wrapperCol={{ span: 22 }}
            initialValues={{ remember: true }}
            onFinish={onFinish}
            onFinishFailed={onFinishFailed}
            autoComplete="off"
          >
            <Form.Item label="出库单号" name="danhao" className="lb">
              <Input />
            </Form.Item>
            <Form.Item label="出库人员" name="renyuan" className="lb">
              <Input />
            </Form.Item>
            <Form.Item label="出库仓库" name="cangku" className="lb">
              <Input />
            </Form.Item>
            <Form.Item label="申请时间" name="time" className="lb">
              <Input />
            </Form.Item>
            <Form.Item label="审核人" name="shenheren" className="lb">
              <Input />
            </Form.Item>
            <Form.Item label="审核时间" name="shenhetime" className="lb">
              <Input />
            </Form.Item>
            <Form.Item label="状态" name="zhuangtai" >
              <Input />
            </Form.Item>
            <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
              <Button className="btn" onClick={cancel}>
                取消
              </Button>
              <Button className="btn" type="primary" htmlType="submit">
                保存
              </Button>
            </Form.Item>
          </Form>
        </div>
      </div>
    </div>
  );
}

export default Createdeposit;
